<!-- 表格搜索栏 -->
<template>
  <div class="container-tableSerch">
    <el-card>
      <div style="display: flex">
        <div class="block">
          <el-date-picker
            v-model="value2"
            type="datetimerange"
            :shortcuts="shortcuts"
            range-separator="To"
            start-placeholder="Start date"
            end-placeholder="End date"
          />
        </div>
        <div class="block" style="margin-left: auto">
          <!-- 搜索 -->
          <el-button type="primary">
            搜索<el-icon class="el-icon--right"><Search /></el-icon>
          </el-button>
          <!-- 重置 -->
          <el-button>
            <el-icon class="el-icon--left"><Refresh /></el-icon>重置
          </el-button>
          <!-- 展开 -->
          <el-dropdown
            trigger="click"
            style="vertical-align: middle; margin-left: 10px"
          >
            <span class="el-dropdown-link">
              展开<el-icon class="el-icon--right"><arrow-down /></el-icon>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item icon="Plus">Action 1</el-dropdown-item>
                <el-dropdown-item icon="CirclePlus">Action 2</el-dropdown-item>
                <el-dropdown-item icon="Check">Action 3</el-dropdown-item>
                <el-dropdown-item icon="CircleCheck">Action 4</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";

const value2 = ref("");

const shortcuts = [
  {
    text: "Last week",
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
      return [start, end];
    },
  },
  {
    text: "Last month",
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      return [start, end];
    },
  },
  {
    text: "Last 3 months",
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
      return [start, end];
    },
  },
];
</script>
